home *** CD-ROM | disk | FTP | other *** search
- ;FILE :DRIVROOM
- ;PURPOSE:To find out room/storage info on any drive in system.
- ;USEAGE :CALL DRVSPACE(drive%,free&,capacity&,free.per%)
- ;drive%= 0- Default 1-A: 2-B: .. etc.
- drivroom segment
- assume cs:drivroom
- push bp ;Saveit, as always
- mov bp,sp
- les di,[bp+12h] ;Should be pointer to drive%
- mov dx,es:[di] ;Okay.. we got the drive
- mov ah,036h ;Tell'm we want free space par'ner.
- int 021h ;GO!
- push dx ;Save clusters on drive.
-
- ;Calculate free bytes.
- mul cx ;CX(byte/sector) x AX(sectors/cluster)
- push ax ;This is bytes/cluster, save it..
- mul bx ;BX(available clusters) x AX(bytes/cluster)
-
- ;Store it.
- les di,[bp+0eh] ;Find where our number is located
- mov es:[di],ax ;lowest bytes
- mov es:[di+2],dx ;Highest bytes.
-
- ;Let's calc total bytes to start with.
- pop ax ;byte/cluster
- pop dx ;clusters/drive
- push dx ;save DX for % calc
- mul dx ;Okay, total drive capacity
- ;Store it.
- les di,[bp+0ah] ;Where variable is
- mov es:[di],ax ;Lower 2 bytes
- mov es:[di+2],dx ;Upper 2 bytes
-
- ;Calc % free from cluster count
- pop cx ;Number of cluster on disk
- mov ax,100d ;100%
- mul bx ;Free clusters. x 100
- div cx ;divide by clusters available
-
- ;Store % result
- les di,[bp+06h] ;Where % variable is
- mov es:[di],ax ;% result
-
- pop bp
- drivroom ends
- end